home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Icon 8.1 / mep1 / External Functions / Samples / testlargeint.c < prev    next >
Encoding:
Text File  |  1990-11-24  |  1.8 KB  |  40 lines  |  [TEXT/KAHL]

  1. e additional arguments whose dptrs are pushed on the stack.
  2.  *
  3.  * dargv[0]      - Arg0 - descriptor to place result
  4.  * dargv[1]      - Arg1 - first user argument
  5.  * dargv[argc]   - Argn - last user argument
  6.  * ip            - pointer to integer used to signal error.  *ip is initialized
  7.  *                 to -1, signifying no error.
  8.  *
  9.  * Possible returns:
  10.  *   Success     - Leave *ip unaltered, return descriptor pointer.
  11.  *   Failure     - Leave *ip unaltered, return NULL.
  12.  *   Error       - Set *ip to error code >= 0.  Return descriptor pointer or NULL
  13.  *                 to have value displayed or not displayed in error message.
  14.  */
  15.  
  16. pascal dptr main(dargv, argc, ip, callback)
  17. dptr dargv;
  18. short int argc;
  19. short int *ip;
  20. pointer (*callback)();
  21. {
  22.    register struct b_bignum *bp;
  23.  
  24.    if (argc != 0)                        /* fail if wrong number of arguments */
  25.       Fail;
  26.  
  27.    if (blkreq(BigNeed(4)) == Error)        /* notify ProIcon of memory needs */
  28.       RunErr(0, NULL);
  29.  
  30.    ArgType(0) = D_Bignum;                /* set bignum result code */
  31.    bp = alcbignum(4);                    /* Allocate 4-DIGIT bignum block */
  32.    BlkLoc(Arg0) = (union block *)bp;    /* point to block containing bignum */
  33.    bp->digits[0] = 0xab54;                /* 0xAB54A98CEB1F0AD2 = 12345678901234567890 */
  34.    bp->digits[1] = 0xa98c;
  35.    bp->digits[2] = 0xeb1f;
  36.    bp->digits[3] = 0x0ad2;
  37.  
  38.    Return;
  39. }
  40.